package com.hopool.shop.service;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.orm.hibernate3.HibernateTemplate;

import com.hopool.shop.dao.BaseDao;
import com.hopool.shop.exception.ServiceException;

public class BaseService implements BaseServiceI{
	protected BaseDao baseDao;
	protected JdbcTemplate jdbcTemplate;
	protected SessionFactory sessionFactory;
	protected HibernateTemplate hibernateTemplate;
	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}
	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
	public Session getSession(){
		return sessionFactory.getCurrentSession();
	}
	public List page(Object exampleobj, Integer firstResult,
			Integer maxResults, String orderType, String... customProperties)
			throws ServiceException {
		return baseDao.page(exampleobj, firstResult, maxResults, orderType, customProperties);
	}
	public Integer count(Object exampleobj, String... customProperties)
			throws ServiceException {
		return baseDao.count(exampleobj, customProperties);
	}
}
